using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
  public  class tbnguoidungBUS
    {
        public static tbnguoidungcollection Get(string where,
         int pageindex,
         int pagesize,
         string orderby,
         string orderdirection,
         out int total)
        {
            tbnguoidungDAL nguoidungDAL = new tbnguoidungDAL();
            return nguoidungDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbnguoidungcollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbnguoidungDAL nguoidungDAL = new tbnguoidungDAL();
            return nguoidungDAL.Get(cri.Criter, 0, 0, nguoidungcolumns.manguoidung.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbnguoidung GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, nguoidungcolumns.manguoidung.ToString(), Condition.EQUAL, iD);
            tbnguoidungDAL nguoidungDAL = new tbnguoidungDAL();
            tbnguoidungcollection nguoidungcollection = nguoidungDAL.Get(cri.Criter,
                     0, 0, nguoidungcolumns.manguoidung.ToString(), OrderDirection.ASC.ToString(), out total);
            if (nguoidungcollection.Count > 0)
                return nguoidungcollection[0];
            return null;
        }
    }
}
